<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="../layout/template.xhtml">
	<ui:define name="content">
		<h:form id="form">
			<p:commandButton value="Novo Usuário"
				action="#{usuarioController.prepararCadastroUsuario}" ajax="false" />

			<p:dataTable id="tableNews"
				value="#{usuarioController.usuarioDataModel}" rows="10"
				paginator="true"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="5,10,15" var="usuario">

				<f:facet name="header">
					<h:outputText value="Usuários" />
				</f:facet>

				<p:column>
					<f:facet name="header">
						<h:outputText value="Nome" />
					</f:facet>

					<h:outputText value="#{usuario.nome}" />
				</p:column>

				<p:column>
					<f:facet name="header">
						<h:outputText value="Email" />
					</f:facet>

					<h:outputText value="#{usuario.email}" />
				</p:column>
				
				<p:column>
					<f:facet name="header">
						<h:outputText value="Alterar" />
					</f:facet>

					<p:commandButton value="" icon="ui-icon-arrowrefresh-1-w"
						actionListener="#{usuarioController.prepararAtualizarUsuario}"
						action="#{usuarioController.carregarAtualizarUsuario}"
						ajax="false">
					</p:commandButton>
				</p:column>

				<p:column>
					<f:facet name="header">
						<h:outputText value="Excluir" />
					</f:facet>


					<p:commandButton value="" icon="ui-icon-close"
						action="#{usuarioController.excluirUsuario}" ajax="false" />
				</p:column>

			</p:dataTable>

		</h:form>
	</ui:define>
</ui:composition>
</html>